{% extends "::base.html.twig" %}

{% block body %}
<div class="row-fluid">

    <div class="span12">

        <div class="box gradient">

            <div class="title">
                <h4>
                    <span>List Employer</span>
                </h4>
            </div>
            <div id="div-list-user" class="content noPad clearfix">
                {% include 'GdsUserBundle:User:listUser.html.twig' %}
                </div>

            </div><!-- End .box -->

        </div><!-- End .span12 -->

    </div><!-- End .row-fluid -->
    <div id="myModal" class="modal hide fade" style="display: none; ">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span class="icon12 minia-icon-close"></span></button>
            <h3 id="form-edit-title"></h3>
        </div>
        <div id="form-edit-body" class="modal-body">
            <div class="margin padding left">
                <img alt="" src="/images/loaders/horizontal/063.gif">
            </div>
        </div>

    </div>
    <div style="display: none" id="modal" title="Dialog Title" class="dialog">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    <script>
        function EditUser(id, name) {
            $('#myModal').modal({show: true});
            $.ajax({
                url: '{{path('gds_user_edit')}}',
                data: 'id=' + id,
                success: function(result) {
                    $('#form-edit-title').html('Employé ' + name)
                    $('#form-edit-body').html(result)
                }
            })
        }
        function RemoveUser(id, name) {
            $('#modal').attr('title','Suppresion :'+name)
            $('#modal').dialog({
                autoOpen: false,
                dialogClass: 'dialog',
                buttons: {
                    "Close": function() {
                        $(this).dialog("close");
                    }
                }
            });
            $('#modal').dialog('open');
        }
        $('#myModal').on('hidden', function() {
            AnnulerEditUser()
        })
        function AnnulerEditUser() {
            $('#myModal').modal({show: false});
            $('#form-edit-title').html('')
            $('#form-edit-body').html('<div class="margin padding left"><img alt="" src="/images/loaders/horizontal/063.gif"></div>')
        }
        </script>

{% endblock body %}